#include "GameOver.h"

using namespace sf;

GameOver::GameOver(sf::RenderWindow &window) :
myWindow(window)
{
	if (!font.loadFromFile("PlaneCrash.ttf"))
	{
		
	}
	//-----------------Game Over text--------------------
	loose.setFont(font);
	loose.setString("game over");
	loose.setCharacterSize(60);
	loose.setColor(sf::Color(200, 30, 30));
	loose.setPosition(180, 40);

	//----------------Press Escape text--------------------
	escape.setFont(font);
	escape.setString("press escape");
	escape.setCharacterSize(20);
	escape.setColor(sf::Color(200, 30, 30));


	//---------------background game over-------------------
	if (!gameOverBackground.loadFromFile("./gameOver.jpg"))
	{
		// erreur MenuBackground
	}
	gameOverSprite.setTexture(gameOverBackground);
	gameOverSprite.setPosition(0, 0);

	//-------------- you Won text---------------------------
	youWon.setFont(font);
	youWon.setString("you won");
	youWon.setCharacterSize(60);
	youWon.setColor(sf::Color(200, 30, 30));
	youWon.setPosition(180, 40);

	//--------------backgroud cacodemon-------------------
	if (!cacodemonBackground.loadFromFile("./cacodemon.png"))
	{
		// erreur MenuBackground
	}
	cacodemonBackground.setSmooth(true);
	cacodemonSprite.setTexture(cacodemonBackground);
	cacodemonSprite.setPosition(0, 70);
	cacodemonSprite.setScale(sf::Vector2f(0.6f, 0.6f));
	cacodemonSprite.setColor(sf::Color(200, 30, 30));

	//--------------backgroud victory-------------------
	if (!victoryBackground.loadFromFile("./marineGreen.png"))
	{
		// erreur MenuBackground
	}
	victoryBackground.setSmooth(true);
	victorySprite.setTexture(victoryBackground);
	victorySprite.setPosition(500, 60);
	victorySprite.setScale(sf::Vector2f(0.4f, 0.4f));

	//--------------backgroud victory 2-------------------
	if (!player2VictoryBackground.loadFromFile("./marineRed.png"))
	{
		// erreur MenuBackground
	}
	player2VictoryBackground.setSmooth(true);
	player2victorySprite.setTexture(player2VictoryBackground);
	player2victorySprite.setPosition(500, 60);
	player2victorySprite.setScale(sf::Vector2f(0.4f, 0.4f));

	//--------------backgroud victory 3-------------------
	if (!player3VictoryBackground.loadFromFile("./blueMarine.png"))
	{
		// erreur MenuBackground
	}
	player3VictoryBackground.setSmooth(true);
	player3victorySprite.setTexture(player3VictoryBackground);
	player3victorySprite.setPosition(500, 60);
	player3victorySprite.setScale(sf::Vector2f(0.4f, 0.4f));

	//--------------backgroud victory 4-------------------
	if (!player4VictoryBackground.loadFromFile("./yellowMarine.png"))
	{
		// erreur MenuBackground
	}
	player4VictoryBackground.setSmooth(true);
	player4victorySprite.setTexture(player4VictoryBackground);
	player4victorySprite.setPosition(500, 60);
	player4victorySprite.setScale(sf::Vector2f(0.4f, 0.4f));

	//------------------player 1 won--------------------------
	player1Won.setFont(font);
	player1Won.setString("green soldier won");
	player1Won.setCharacterSize(50);
	player1Won.setColor(sf::Color(200, 30, 30));
	player1Won.setPosition(50, 40);

	//------------------player 2 won--------------------------
	player2Won.setFont(font);
	player2Won.setString("red soldier won");
	player2Won.setCharacterSize(50);
	player2Won.setColor(sf::Color(200, 30, 30));
	player2Won.setPosition(50, 40);

	//------------------player 3 won--------------------------
	player3Won.setFont(font);
	player3Won.setString("blue soldier won");
	player3Won.setCharacterSize(50);
	player3Won.setColor(sf::Color(200, 30, 30));
	player3Won.setPosition(50, 40);

	//------------------player 4 won--------------------------
	player4Won.setFont(font);
	player4Won.setString("yellow soldier won");
	player4Won.setCharacterSize(50);
	player4Won.setColor(sf::Color(200, 30, 30));
	player4Won.setPosition(50, 40);
}

GameOver::~GameOver()
{


}

void GameOver::GameOverDisplay(int game)
{

	if (game == 0)
	{
		//myWindow.draw(gameOverSprite);
		myWindow.draw(cacodemonSprite);
		myWindow.draw(loose);
		escape.setPosition(500, 450);
		myWindow.draw(escape);
	}
	else if (game == 1)
	{
		myWindow.draw(gameOverSprite);
		myWindow.draw(victorySprite);
		myWindow.draw(player1Won);
		escape.setPosition(50, 100);
		myWindow.draw(escape);
	}
	else if (game == 2)
	{
		myWindow.draw(gameOverSprite);
		myWindow.draw(player2victorySprite);
		myWindow.draw(player2Won);
		escape.setPosition(50, 100);
		myWindow.draw(escape);
	}
	else if (game == 3)
	{
		myWindow.draw(gameOverSprite);
		myWindow.draw(player3victorySprite);
		myWindow.draw(player3Won);
		escape.setPosition(50, 100);
		myWindow.draw(escape);
	}
	else if (game == 4)
	{
		myWindow.draw(gameOverSprite);
		myWindow.draw(player4victorySprite);
		myWindow.draw(player4Won);
		escape.setPosition(50, 100);
		myWindow.draw(escape);
	}
	else if (game == 5)
	{
		myWindow.draw(gameOverSprite);
		myWindow.draw(victorySprite);
		myWindow.draw(youWon);
		escape.setPosition(50, 100);
		myWindow.draw(escape);
	}
}